package stu.day19_day24.day19;

public class LeetCode1749 {
    public int maxAbsoluteSum(int[] nums) {

        int[] array = new int[nums.length+1];
        int num = 0;
        for (int i=0;i<nums.length;i++){
            num += nums[i];
            array[i+1] = num;
        }

        int max = array[0];
        for (int i=1;i<array.length;i++){
            max = Math.max(max,array[i]);
        }

        int min = array[0];
        for (int i=1;i<array.length;i++){
            min = Math.min(min,array[i]);
        }

        return Math.abs(max-min);

    }
}
